<template>
  <div>
    <!-- 查看详情 2018/7/20 zhangQ -->
    <navbar>
    </navbar>
    <mu-card id="stationViewDetail" style="width: 100%; max-width: 375px; margin: 10px auto;">
      <mu-card-text v-if="isShow">
        <mu-row>
          <mu-col>
            <div>
              入线时间：{{ trainOrderDetails[0].enterTime }}
            </div>
            <div>
              货票号：{{ trainOrderDetails[0].waybillNo }}
            </div>
            <div>
              车号：{{ trainOrderDetails[0].carriageNo }}
            </div>
            <div>
              施封号：{{ trainOrderDetails[0].sealNo }}
            </div>
          </mu-col>
        </mu-row>
        <mu-divider style="margin: 5px 0;"></mu-divider>
        <mu-row>
          <mu-col>
            <div>
              货物名称：{{ trainOrderDetails[0].pm }}
            </div>
            <div>
              件数：{{ trainOrderDetails[0].cargoNumber }}
            </div>
            <div>
              箱型箱类：{{ trainOrderDetails[0].trainType }}
            </div>
            <div>
              箱号一：{{ trainOrderDetails[0].containerNo?trainOrderDetails[0].containerNo:'' }}
            </div>
            <div v-if="trainOrderDetails.length>1">
              箱号二：{{ trainOrderDetails[1].containerNo?trainOrderDetails[1].containerNo:'' }}
            </div>
            <div>
              集装箱施封号：{{ trainOrderDetails[0].sealNo }}
            </div>
            <div>
              运价号：{{ trainOrderDetails[0].sealNo }}
            </div>
            <div>
              卸车地点：{{ trainOrderDetails[0].positionTrack }}
            </div>
            <div>
              发站：{{ trainOrderDetails[0].startStationName }}
            </div>
            <div>
              托运人：{{ trainOrderDetails[0].shipper }}
            </div>
            <div>
              收货人：{{ trainOrderDetails[0].receiver }}
            </div>
            <div>
              联系电话：{{ trainOrderDetails[0].outMobile }}
            </div>
          </mu-col>
        </mu-row>
      </mu-card-text>
    </mu-card>
  </div>
</template>

<script>
  import {getTrainOrderDetailByCarriageNo} from '@/api/common'

  export default {
    name: 'viewDetail',
    data () {
      let isShow = false
      let trainOrderDetails = [{}, {}]
      let datas = {trainOrderDetails, isShow}
      return datas
    },
    props: {
      carriageNo: {},
      trainOrderId: {}
    },
    computed: {},
    methods: {},
    created () {
    },
    mounted () {
      if (!this.carriageNo || !this.trainOrderId) {
        this.$router.go(-1)
      } else {
        getTrainOrderDetailByCarriageNo({carriageNo: this.carriageNo, trainOrderId: this.trainOrderId}).then(res => {
          if (+res.data.isSuccess === 1) {
            let resData = res.data
            this.trainOrderDetails = resData.data
            if (resData.data.length > 0) {
              this.isShow = true
            } else {
              this.$toast.error('暂无详情！')
              this.$router.go(-1)
            }
            console.log('res.data', resData)
          }
        })
      }
    },
    components: {}
  }
</script>

<style scoped>
  #stationViewDetail div {
    line-height: 30px;
  }
</style>
